<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../js/angular.min.js"></script>
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

</head>
<body>
<div ng-app="myApp" ng-controller="siteCtrl">

    <table class="table table-striped table-bordered">
        <tr>
            <th ng-repeat="x in titles">{{x}}</th>
            <th>操作</th>
        </tr>
        <tr ng-repeat="ls in lss">
            <td ng-repeat="x in ls">{{x}}</td>
            <td><a href="#">编辑</a><a href="#">删除</a></td>
        </tr>

    </table>

    <ul class="pager">
        <li><a href="#">Previous</a></li>
        <li><a href="#">Next</a></li>
    </ul>

</div>

<script>
    var app = angular.module('myApp', []);

    app.controller('siteCtrl', function ($scope, $http) {
        $http.get("/Customer").then(function (response) {
            var data = response.data;
            var b = data._embedded;
            console.log(b);
            var m = {};
            var i, list, ls, k;

            for (i in b) {
                list = b[i];
                for (i in list) {
                    i = list[i];
                    for (i in i)
                        if (!(i in m))
                            m[i] = 0;
                }
            }

            delete m._links;

            $scope.titles = Object.keys(m);

            var ts = $scope.titles;

            $scope.lss = [];
            for (i in list) {
                ls = [];
                k = list[i];
                for (i in ts) {
                    i = ts[i];
                    ls.push(k[i]);
                }
                $scope.lss.push(ls);
            }

            $scope.page = data.page;
            $scope.links = data._links;

        }, function (response) {
            alert('n');
        });
        console.log(location.search)

    });

    function GetQueryString(name) {
        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
        var r = location.search.match(reg);
        if (r !== null) return decodeURI(r[2]);
        return null;

        setTimeout()


    }

</script>


</body>
</html>